package com.qf.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by 54110 on 2021/6/22.
 */
//resultful格式
@RestController //@ResponseBody+@Controller
@RequestMapping("/second")
public class SecondMvcController {



    //标注放回的内容不再是 页面的名称了，而是Json数据
    @RequestMapping("/first")
    public String first(){
        System.out.println("111");
        return "index";
    }

    /**
     * get 请求与post的区别：
     * get请求的参数是批结到url上的
     * post请求是放在请求体中的
     * @return
     */
    //restful格式，以get请求访问，默认时get
    @RequestMapping(value = "/first/get",method = RequestMethod.GET)
    public String firstGet(){
        return "index";
    }

    @RequestMapping(value = "/second/post",method = RequestMethod.POST)
    public String secondPost(){
        return "post success";
    }

}
